//
//  DNFeedingVC.m
//  DanoneEA
//
//  Created by Senela on 16/9/23.
//  Copyright © 2016年 翔傲科技. All rights reserved.
//

#import "DNFeedingListVC.h"
#import "DNFeedingChartVC.h"
#import "DNPickerView.h"

@interface DNFeedingListVC ()

@end

@implementation DNFeedingListVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
     NAV_INIT(self, DNNSLocalizedString(@"NavTitle_Feeding",@""),
              DNNSLocalizedString(@"NavLeft_SidePanelButton", @""),
              @selector(leftDrawerButtonPress:),
              DNNSLocalizedString(@"NavRight_SidePanelButton", @""),
              @selector(rightButtonPress:));
    self.type = ModuleType_Feeding;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/


#pragma mark - UIAction methods
/**
 *  the left navigation button respons to events
 *
 *  @param sender left navigation button
 */
-(void)leftDrawerButtonPress:(id)sender{
    [self.mm_drawerController toggleDrawerSide:MMDrawerSideLeft animated:YES completion:nil];
}


/**
 *  the right navigation button respons to events
 *
 *  @param sender right navigation button
 */
-(void)rightButtonPress:(id)sender{
   
//    NSMutableArray *vcArray = [NSMutableArray arrayWithArray:self.navigationController.viewControllers];
//    DNFeedingChartVC *vc = [[DNFeedingChartVC alloc] init];
//    [vcArray removeLastObject];
//    [vcArray addObject:vc];
//    self.navigationController.viewControllers = vcArray;
    
    
    DNPickerView *picker = [[DNPickerView alloc] initWithFrame:CGRectMake(0, 50, SCREEN_WIDTH, 256)];
    [self.view addSubview:picker];
    
//    NSArray *hourArr =  @[@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"10",@"11",@"12"];
//    NSArray *unitArr =  @[@"hours"];
//    picker.arrPickerData =  @[hourArr, unitArr];
//    picker.autoHide = YES;
    
    NSArray *hourArr =  @[@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"10",@"11",@"12"];
    NSArray *minuteArr =  @[@"00", @"01",@"02",@"03",@"04",@"05",@"06",@"07",@"08",@"09",@"10",@"11",@"12"];
    NSArray *unitArr =  @[@"AM", @"PM"];
    
    float width1 = (SCREEN_WIDTH -50)/2;
//    picker.widthForComponentArr = @[[NSString stringWithFormat:@"%f",width1], @"50", [NSString stringWithFormat:@"%f",width1]];
    picker.arrPickerData =  @[hourArr, minuteArr, unitArr];
    
    
    
    [picker popPickerView];
    
    picker.selectBlock = ^(NSInteger components, NSInteger row)
    {
        DDLogVerbose(@"selectBlock -- %d %d", components, row);
    };
}

@end
